home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Data 2002 May / CD Rom Data Mayıs 2002.iso / Freeware / Blitz Basic / data1.cab / Support / help / samples / fileio.bb < prev    next >
Encoding:
Text File  |  2002-04-10  |  708 b   |  39 lines

  1.  
  2. ;write and read a binary file...
  3. Print "Binary file test"
  4. test=WriteFile( "test" )
  5.  
  6. For k=1 To 3
  7.     WriteByte test,k
  8.     WriteShort test,k
  9.     WriteInt test,k
  10.     WriteFloat test,k
  11. Next
  12. WriteString test,"Mark Sibly!"
  13. CloseFile test
  14.  
  15. test=ReadFile( "test" )
  16. For k=1 To 3
  17.     Print ReadByte( test )
  18.     Print ReadShort( test )
  19.     Print ReadInt( test )
  20.     Print ReadFloat( test )
  21. Next
  22. t$=ReadString( test )
  23. Print t$+" "+Len( t$ )
  24. CloseFile test
  25.  
  26. ;write and read a text file...
  27. Print "Text file test"
  28. test=WriteFile( "test" )
  29. WriteLine test,"Line 1"
  30. WriteLine test,4/2
  31. WriteLine test,10.5
  32. CloseFile test
  33.  
  34. test=ReadFile( "test" )
  35. While Not Eof(test)
  36.     Print ReadLine$( test )
  37. Wend
  38. CloseFile test
  39.